import React, { Component, RefObject } from 'react';
import './index.scss';
import BannerCom, { WebHomeBanner } from './banner'
import LinksCom from './links'
import StudyTimeLineCom from './studyTimeLine'
import WClock from '../../../components/clock'
import { updateWebNavIndex } from '../../../store/app/actions'

interface StateInterface {
  bannerRef: RefObject<WebHomeBanner> // tslint:disable-line
}

interface PropsInterface {
}

class WebHome extends Component<PropsInterface, StateInterface> {

  state: StateInterface = {
    bannerRef: React.createRef()
  }

  componentDidMount() {
    updateWebNavIndex('0')
  }

  render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | string | number | {} | React.ReactNodeArray | React.ReactPortal | boolean | null | undefined {
    return ([
      <WClock key={'WClock'}></WClock>,
      <BannerCom ref={ this.state.bannerRef } key={'BannerCom'} />,
      <LinksCom key={'LinksCom'} />,
      <StudyTimeLineCom key={'StudyTimeLineCom'} />,
    ]);
  }
}

export default WebHome;